/*
 * DiaryListFragment.java
 * classes : com.ruint.master.app.fragment.DiaryListFragment
 * @author ruint
 * V 1.0.0
 * Create at 2014-12-2 下午4:15:30
 */
package com.ruint.master.app.fragment;

import com.ruint.core.utils.volley.RequestManager.GenericCallback;
import com.ruint.core.view.BaseRefreshListFragment;
import com.ruint.lib.pulltorefresh.library.PullToRefreshBase.Mode;
import com.ruint.master.adapter.DiaryListAdapter;
import com.ruint.master.app.MasterApplication;
import com.ruint.master.bean.Diary;
import com.ruint.master.bean.DiaryWrapper;

/**
 * com.ruint.master.app.fragment.DiaryListFragment
 * 
 * @author ruint <br/>
 *         create at 2014-12-2 下午4:15:30
 * @param <T>
 * @param <V>
 */
public class DiaryListFragment extends BaseRefreshListFragment<Diary, DiaryListAdapter> {

  @Override
  public DiaryListAdapter newAdapter() {
    return new DiaryListAdapter(getActivity(), mListView);
  }

  @Override
  public Mode refreshMode() {
    return Mode.PULL_FROM_START;
  }

  @Override
  public void onListRefresh() {
    MasterApplication.getApp().getApi().getDiaryList(getActivity(), new GenericCallback<DiaryWrapper>() {

      @Override
      public void onResponse(DiaryWrapper result) {
        injectData(result.getData());
      }

      @Override
      public void onRequestFailed() {
      }
    });
  }

  @Override
  public void headRefresh() {

  }

  @Override
  public void footRefresh() {
  }
}
